<!DOCTYPE HTML>
<#--
/**
 * Copyright 2012 Claude Houle claude.houle@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<html>
<#escape x as x?html>
	<#include "/web/widgets/ui-button.ftl" />
	<#include "/web/widgets/ui-textfield.ftl" />




	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link rel="shortcut icon" href="/favicon.ico" />
		<link rel="stylesheet/less" type="text/css" href="/change_pwd/invalid" />
		<link rel="stylesheet" type="text/css" href="/libs/jqueryui/jquery-ui-1.8.16.custom.css" />

		<script type="text/javascript" src="/libs/less-1.2.0.min.js"></script>
		<script type="text/javascript" src="/libs/jquery/jquery-1.7.1.min.js"></script>
		<script type="text/javascript" src="/libs/jqueryui/jquery-ui-1.8.16.custom.min.js"></script>
		<title>${i18n("headtitle")}</title>

		<script type="text/javascript">
			$().ready( function(){
				$("#btn_send").click( 	function( event ){
					if( $("#f_user").val() != "" ){
						$.ajax("forgot_pwd", {
							type: 'POST',
							async: true,
							cache: false,
							data:   { username: $('#f_user').val() },
							error:  function( jqXHR, status, error ){
								window.location.reload(true);
							},
							success:  function( data, status, error ){
								window.location.replace(data);
							},
							timeout: 60000
						});
					}
				});

				$("#btn_cancel").click( function( event ) {
					window.location.replace('/login');
				} );


				$(window).keypress( function(event){
			 		if ( event.which == 13 ) {
						event.preventDefault();
						if( $("#f_user").val() != "" ){
				   			$("#btn_send").click();
						}
					}
				});
			});
		</script>
	</head>
	<body>
		<div class="uic-login">
			<div class="uic-login-title"></div>
			<center>
				<div class="uic-login-container uic-box-shadow ">
					<div class="uic-login-header ">
						<div class=" uic-login-header-row">
							<div class="uic-login-header-row-left">
								<div class="uic-login-env">${env}</div>
							</div>
							<div class=" uic-login-header-row-right">

							</div>
						</div>
						<div class=" uic-login-header-row uic-login-help">
							<center>
								<div class="uic-login-env">${i18n("title")}</div>
							</center>
						</div>
					</div>
					<div class="uic-login-content">
						<center>
							<div class="uic-login-message">${i18n("msgPart1_fragment1")} <strong>${i18n("msgPart1_fragment2")}</strong>${i18n("msgPart1_fragment3")}</div>
							<div class="uic-login-message">${i18n("msgPart2")}</div>
							<table class="uic-change-pwd-form">
								<tr class="uic-change-pwd-form-row">
									<td class="uic-login-lbl"><div>${i18n("lblUsername")}</div></td>
									<td class="uic-login-field">
										<@textfield id="f_user" maxlength=20 />
									</td>
								</tr>
							</table>
						</center>
					</div>
					<div class="uic-login-action">
						<center>
							<@button id="btn_send" caption=i18n("btnSend") />
							<@button id="btn_cancel" caption=i18n("btnCancel") />
						</center>
					</div>
				</div>
			</center>
		</div>

	</body>
</#escape>
</html>